package com.Dialogs;


import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import com.Adapters.PictureListAdapter;
import com.Adapters.Items.ItemProfile;
import com.Managers.FragmentManagerClass;
import com.Managers.PictureIntentManagerClass;
import com.shareup.R;


public class DialogShareText extends AlertDialog {

    private final ListView itemlist;

    private final OnItemClickListener OnOption = new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {

            switch (position) {
                case 0:
                    PictureIntentManagerClass.createChooserImage(FragmentManagerClass.aMain);
                    break;
                case 1:
                    new DialogPostText(getContext()).Show();
                    break;
            }

            dismiss();
        }
    };

    private final View view;

    public DialogShareText(Context context) {

        super(context);

        LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.dialog_action_list, null);
        //
        itemlist = (ListView) view.findViewById(R.id.item_list);
        //
        //
        this.setView(view);
        //
        String[] list = context.getResources().getStringArray(R.array.share);
        PictureListAdapter adapter = new PictureListAdapter(context, R.layout.option_picture_text, R.id.text_comment);
        //
        adapter.add(new ItemProfile(list[0], R.drawable.new_picture_icon_pressed, 0, false));
        adapter.add(new ItemProfile(list[1], R.drawable.comment_icon_normal, 0, false));
        //
        itemlist.setAdapter(adapter);
        itemlist.setOnItemClickListener(OnOption);
    }

}
